package com.octopus.optiworks.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Transient;

import org.hibernate.annotations.Index;

@SuppressWarnings("serial")
@Entity
@Table
public class Product implements Serializable{
	
	private Long id;
	
	private String processId;
	
	private String status;
	
	private Boolean archive = false;
	
	private String lockedBy;
	
	private Template template;
	
	private Long stepSpecId;
	
	private StepSpec stepSpec;
	
	private String lot;
	
	private String wono;
	
	private String ituch;
	
	private String itunm;
	
	private String finalSn;
	
	private String internalSn;
	
	private String pn;
	
	private String frequency;
	
	private String channelPb2;
	
	private Date createDate;
	
	private Set<Step10_1Data> step10_1Datas;
	
	private Set<Step10_2Data> step10_2Datas;
	
	private Set<Step20Data> step20Datas;
	
	private Set<Step30_1Data> step30_1Datas;
	
	private Set<Step30_2Data> step30_2Datas;
	
	private Set<Step40Data> step40Datas;
	
	private Set<Step50Data> step50Datas;
	
	private Set<Step60Data> step60Datas;
	
	private Set<Step70Data> step70Datas;
	
	private Set<Step80Data> step80Datas;
	
	private Set<Step90Data> step90Datas;
	
	private Set<Step100_1Data> step100_1Datas;
	
	private Set<Step100_2Data> step100_2Datas;
	
	private Set<Step100_3Data> step100_3Datas;
	
	private Set<Step110Data> step110Datas;
	
	private Set<Step120_1Data> step120_1Datas;
	
	private Set<Step120_2Data> step120_2Datas;
	
	private Set<Step130Data> step130Datas;
	
	private Set<Step140_1Data> step140_1Datas;
	
	private Set<Step140_2Data> step140_2Datas;
	
	private Set<Step150Data> step150Datas;
	
	private Set<Step160Data> step160Datas;
	
	private Set<Step170_1Data> step170_1Datas;
	
	private Set<Step170_2Data> step170_2Datas;
	
	private Set<Step180Data> step180Datas;
	
	private DataSheet dataSheet;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column
    @Index(name="idx_product_finalsn")
	public String getFinalSn() {
		return finalSn;
	}

	public void setFinalSn(String finalSn) {
		this.finalSn = finalSn;
	}

	@Column
    @Index(name="idx_product_internalsn")
	public String getInternalSn() {
		return internalSn;
	}

	public void setInternalSn(String internalSn) {
		this.internalSn = internalSn;
	}

	@Column
	public String getPn() {
		return pn;
	}

	public void setPn(String pn) {
		this.pn = pn;
	}

	@Column
	public String getFrequency() {
		return frequency;
	}

	public void setFrequency(String frequency) {
		this.frequency = frequency;
	}

	@Column
	public String getChannelPb2() {
		return channelPb2;
	}

	public void setChannelPb2(String channelPb2) {
		this.channelPb2 = channelPb2;
	}

	@Column
    @Index(name="idx_product_processid")
	public String getProcessId() {
		return processId;
	}

	public void setProcessId(String processId) {
		this.processId = processId;
	}
	
    @Basic(optional=false)
	@Column
    @Index(name="idx_product_status")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	@Column
    @Index(name="idx_product_lockedby")
	public String getLockedBy() {
		return lockedBy;
	}

	public void setLockedBy(String lockedBy) {
		this.lockedBy = lockedBy;
	}

	@Column
    @Index(name="idx_product_lot")
	public String getLot() {
		return lot;
	}

	public void setLot(String lot) {
		this.lot = lot;
	}

	@Column
	public String getWono() {
		return wono;
	}

	public void setWono(String wono) {
		this.wono = wono;
	}

	@Column
	public String getItuch() {
		return ituch;
	}

	public void setItuch(String ituch) {
		this.ituch = ituch;
	}
	
	@Column
	public String getItunm() {
		return itunm;
	}

	public void setItunm(String itunm) {
		this.itunm = itunm;
	}

	@Column
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step10_1Data> getStep10_1Datas() {
		return step10_1Datas;
	}

	public void setStep10_1Datas(Set<Step10_1Data> step10_1Datas) {
		this.step10_1Datas = step10_1Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step10_2Data> getStep10_2Datas() {
		return step10_2Datas;
	}

	public void setStep10_2Datas(Set<Step10_2Data> step10_2Datas) {
		this.step10_2Datas = step10_2Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step20Data> getStep20Datas() {
		return step20Datas;
	}

	public void setStep20Datas(Set<Step20Data> step20Datas) {
		this.step20Datas = step20Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step30_1Data> getStep30_1Datas() {
		return step30_1Datas;
	}

	public void setStep30_1Datas(Set<Step30_1Data> step30_1Datas) {
		this.step30_1Datas = step30_1Datas;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step30_2Data> getStep30_2Datas() {
		return step30_2Datas;
	}

	public void setStep30_2Datas(Set<Step30_2Data> step30_2Datas) {
		this.step30_2Datas = step30_2Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step40Data> getStep40Datas() {
		return step40Datas;
	}

	public void setStep40Datas(Set<Step40Data> step40Datas) {
		this.step40Datas = step40Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step50Data> getStep50Datas() {
		return step50Datas;
	}

	public void setStep50Datas(Set<Step50Data> step50Datas) {
		this.step50Datas = step50Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step60Data> getStep60Datas() {
		return step60Datas;
	}

	public void setStep60Datas(Set<Step60Data> step60Datas) {
		this.step60Datas = step60Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step70Data> getStep70Datas() {
		return step70Datas;
	}

	public void setStep70Datas(Set<Step70Data> step70Datas) {
		this.step70Datas = step70Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step80Data> getStep80Datas() {
		return step80Datas;
	}

	public void setStep80Datas(Set<Step80Data> step80Datas) {
		this.step80Datas = step80Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step90Data> getStep90Datas() {
		return step90Datas;
	}

	public void setStep90Datas(Set<Step90Data> step90Datas) {
		this.step90Datas = step90Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step100_1Data> getStep100_1Datas() {
		return step100_1Datas;
	}

	public void setStep100_1Datas(Set<Step100_1Data> step100_1Datas) {
		this.step100_1Datas = step100_1Datas;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step100_2Data> getStep100_2Datas() {
		return step100_2Datas;
	}

	public void setStep100_2Datas(Set<Step100_2Data> step100_2Datas) {
		this.step100_2Datas = step100_2Datas;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step100_3Data> getStep100_3Datas() {
		return step100_3Datas;
	}

	public void setStep100_3Datas(Set<Step100_3Data> step100_3Datas) {
		this.step100_3Datas = step100_3Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step110Data> getStep110Datas() {
		return step110Datas;
	}

	public void setStep110Datas(Set<Step110Data> step110Datas) {
		this.step110Datas = step110Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step120_1Data> getStep120_1Datas() {
		return step120_1Datas;
	}

	public void setStep120_1Datas(Set<Step120_1Data> step120_1Datas) {
		this.step120_1Datas = step120_1Datas;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step120_2Data> getStep120_2Datas() {
		return step120_2Datas;
	}

	public void setStep120_2Datas(Set<Step120_2Data> step120_2Datas) {
		this.step120_2Datas = step120_2Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step130Data> getStep130Datas() {
		return step130Datas;
	}

	public void setStep130Datas(Set<Step130Data> step130Datas) {
		this.step130Datas = step130Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step140_1Data> getStep140_1Datas() {
		return step140_1Datas;
	}

	public void setStep140_1Datas(Set<Step140_1Data> step140_1Datas) {
		this.step140_1Datas = step140_1Datas;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step140_2Data> getStep140_2Datas() {
		return step140_2Datas;
	}

	public void setStep140_2Datas(Set<Step140_2Data> step140_2Datas) {
		this.step140_2Datas = step140_2Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step150Data> getStep150Datas() {
		return step150Datas;
	}

	public void setStep150Datas(Set<Step150Data> step150Datas) {
		this.step150Datas = step150Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step160Data> getStep160Datas() {
		return step160Datas;
	}

	public void setStep160Datas(Set<Step160Data> step160Datas) {
		this.step160Datas = step160Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step170_1Data> getStep170_1Datas() {
		return step170_1Datas;
	}

	public void setStep170_1Datas(Set<Step170_1Data> step170_1Datas) {
		this.step170_1Datas = step170_1Datas;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step170_2Data> getStep170_2Datas() {
		return step170_2Datas;
	}

	public void setStep170_2Datas(Set<Step170_2Data> step170_2Datas) {
		this.step170_2Datas = step170_2Datas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Step180Data> getStep180Datas() {
		return step180Datas;
	}

	public void setStep180Datas(Set<Step180Data> step180Datas) {
		this.step180Datas = step180Datas;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "TEMPLATEID")
	public Template getTemplate() {
		return template;
	}

	public void setTemplate(Template template) {
		this.template = template;
	}

	@Column
	public Long getStepSpecId() {
		return stepSpecId;
	}

	public void setStepSpecId(Long stepSpecId) {
		this.stepSpecId = stepSpecId;
	}

	@Transient
	public StepSpec getStepSpec() {
		return stepSpec;
	}

	public void setStepSpec(StepSpec stepSpec) {
		this.stepSpec = stepSpec;
	}

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public DataSheet getDataSheet() {
		return dataSheet;
	}

	public void setDataSheet(DataSheet dataSheet) {
		this.dataSheet = dataSheet;
	}

	@Column
	@Index(name="idx_product_archive")
	public Boolean getArchive() {
		return archive;
	}

	public void setArchive(Boolean archive) {
		this.archive = archive;
	}

}
